<jsp:root version="1.2" xmlns:jsp="http://java.sun.com/JSP/Page" 
xmlns:c="http://java.sun.com/jstl/core">
  <jsp:directive.page contentType="text/html; charset=ISO-8859-1" />

<jsp:directive.page import="Jt.*" />
<jsp:directive.page import="Jt.examples.*" />
<html>
<head>
<title>HelloWorld.jsp - Example of JSP support</title>
</head>
<body>




<!-- HelloWorld.jsp - Example of JSP support -->


<!-- Create the component factory  -->

<!-- This is java bean to create factory of JtObjects -->
<jsp:useBean id='factory' class='Jt.JtFactory' scope='request'/>

<!-- Create the helloWorld component -->

<jsp:scriptlet>


HelloWorldMessage helloWorld = null; 
try
{
	
	//Create HelloWorldMessage message using factory and the class name JtCLASS_NAME
helloWorld = (HelloWorldMessage) factory.createObject (HelloWorldMessage.JtCLASS_NAME); 

}
catch(Exception ex)
{
out.println(ex.getMessage());
}
</jsp:scriptlet>



<!-- Implement the business logic by sending a message to the component  -->

<jsp:scriptlet> 
try
{
	// sending message 
String jtReply = (String) factory.sendMessage (helloWorld, "hi"); 
request.setAttribute ("jtReply", jtReply);
                //display reply message 
out.println(jtReply);
}
catch(Exception ex)
{
out.println(ex.getMessage());
}

</jsp:scriptlet>




<!-- View the message reply -->

<c:out value="${jtReply}"/>

</body>
</html>


</jsp:root>
